<template>
	<!--客户我的票夹-->
	<view>
		<view class="content1">
			<u-search inputAlign="left" height="30" bgColor="#ffffff"></u-search>
		</view>
	<!--发票列表显示开始-->
			<view class="indexList" v-for="(item, ticketLists) in ticketLists" @click="toDetail(item.id)">
				<view class="ad-indexList">
					<view class="ad-List">
						<!--显示抬头名称-->
						<view class="ad-List-text">
							发票名称:	
						<view class="list-text-01">{{ item.invoiceName }}</view>
						</view>

						<!--显示税号-->
						<view class="ad-List-text">
							税号:	
						<view class="list-text-01">{{ item.taxNo }}</view>
						</view>

						
						<!--显示金额-->
						<view class="ad-List-text">
							金额:	
						<view class="list-text-01">{{ item.txnAmt }}</view>
						</view>

						<!--显示开票内容-->
						<view class="ad-List-text" v-if="item.content">
							开票内容:
							<view class="list-text-01">{{item.content}}</view>
						</view>
						<!--显示状态-->
						<view class="ad-List-text">
							状态:
							<view class="list-text-01">
								<view v-if="item.state == '1'">客户新增</view>
								<view v-else-if="item.state == '2'">商家已处理</view>
								<view v-else-if="item.state == '3'">后台已处理</view>
								<view v-else-if="item.state == '4'">已退回</view>
							</view>
						</view>
						
					</view>
				</view>
			</view>
			<!--发票列表显示结束-->
		<view class="bgimge" v-if="ticketLists.length<=0">
			<image
			        src="/static/icon/empty4.png"
			>
			</image>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				ticketLists: {}, //发票列表
				title: 'Hello',

			}
		},
		onLoad() {
			var me = this;
			var userinfo = uni.getStorageSync("user")
			//打印数值
			console.log('user' + JSON.stringify(userinfo));
			uni.request({
				url: me.$ServerUrl + '/invoice/api/invoice/getInvoiceListByCustomerId',
				data: {
					customerId: userinfo.id
				},
				header: {
					'content-type': 'application/x-www-form-urlencoded'
				},
				method: "GET",
				success: (res) => {
					console.log('res' + JSON.stringify(res));
					me.ticketLists = res.data
					console.log(me.ticketLists)
					console.log(res)


				},
			})


		},
		methods: {


			toDetail(id) {
				// console.log('点击了呀');
				// console.log(id);
				uni.navigateTo({
					url: './upticket?id=' + id,

				})

			},

		}

	}
</script>

<style>
	page {
		width: 100%;
		height: 100%;
		background-color: #e1e5eb;
	}

	.content1 {
		margin: 10px;
	}

	// list
	.indexList {
		text-align: left;
		width: 100%;
		border-radius: 10px;
	}

	.ad-indexList {
		border: 1px solid #ffffff;
		border-radius: 10px;
		background-color: #ffffff;
		margin-top: 5px;
		margin-left: 10px;
		margin-right: 10px;
		padding: 10px;
		box-shadow: 2px 2px 2px #a1a1a1;
	}

	.ad-List {
		font-size: 14px;
	}

	.ad-List-text {
		text-overflow: ellipsis;
		white-space: nowrap;
		overflow: hidden;
		display: flex;
		margin-bottom: 5px;
		width: 90%;
	}

	.list-text-01 {
		margin-left: 10px;
		width: 100%;
		overflow: auto;
	}
	.bgimge {
		color: #999999;
		text-align: center;
		justify-content: center;
		align-items: center;
	}
	.bgimge image{
		width: 150px;
		height: 170px;
	}
</style>
